package main

import (
	"fmt"
	"time"
)

func write(ch chan<- int) {
	var i int
	for {
		ch <- i
		i ++
		time.Sleep(time.Millisecond)
	}
}

func read(ch <-chan int) {
	for {
		b := <- ch
		fmt.Println(b)
	}
}

func main() {
	intChan := make(chan int, 10)
	go write(intChan)
	go read(intChan)
	time.Sleep(time.Second * 5)
}